package com.njwb.day16.dom.Class;

import org.apache.log4j.Logger;
import java.util.InputMismatchException;
import java.util.Scanner;

public class course {
    public static Logger logger = Logger.getLogger("com.njwb.day16.dom.Class");

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        try {
            System.out.println("1.语文  2.数学  3.英语");
            System.out.println("请选择课程");
            int x = sc.nextInt();
            logger.info("用户选择了课程编号: " + x);

            switch (x) {
                case 1:
                    System.out.println("语文课！");
                    logger.debug("进入语文课程分支");
                    break;
                case 2:
                    System.out.println("数学课！");
                    logger.debug("进入数学课程分支");
                    break;
                case 3:
                    System.out.println("英语课！");
                    logger.debug("进入英语课程分支");
                    break;
                default:
                    System.out.println("输入不合法！！！");
                    logger.warn("用户输入非法课程编号: " + x);
            }

        } catch (InputMismatchException e) {
            System.out.println("输入的不是数字！！");
            logger.error("捕获到InputMismatchException", e);
        } finally {
            System.out.println("欢迎提出建议！");
            logger.info("程序执行结束");
        }
    }
}
